package org.example;

import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;
import java.net.URISyntaxException;

/**
 * 文件的上传
 */
public class HdfsClientPut {


    public static void main(String[] args) throws URISyntaxException, IOException, InterruptedException {

        String pathLocal = HdfsClientPut.class.getClassLoader().getResource("").getPath();


        try (FileSystem fs = HadoopConnectUtil.getFileSystem()) {
            fs.copyFromLocalFile(
                    false,
                    true,
                    new Path( pathLocal + "/hello.txt"),
                    new Path("/danci")

            );

        }
    }
}